package cn.tedu.poresonnel.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.tedu.poresonnel.mapper.PoersonnelMappper;
import cn.tedu.poresonnel.pojo.param.PoresonnelParam;
import cn.tedu.poresonnel.pojo.vo.PoresonnelVO;
import cn.tedu.poresonnel.service.PoresonnelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


@Service
@Slf4j
public class PoresonnelServiceImpl implements PoresonnelService {
    @Autowired
    PoersonnelMappper poersonnelMappper;


    @Override
    public List<PoresonnelVO> queryporesonnel(PoresonnelParam poresonnelParam) {
        log.debug("查询人员信息+{}",poresonnelParam);
        poresonnelParam.setId(7);
        List<PoresonnelVO> list = poersonnelMappper.querypoersonnel(poresonnelParam);
        return list;
    }

    @Override
    public void addporesonnel(PoresonnelVO poersonnelVO) {
        log.debug("添加人员信息+{}",poersonnelVO);
        PoresonnelParam poresonnelParam=new PoresonnelParam();
        BeanUtil.copyProperties(poersonnelVO,poresonnelParam);
        if (poresonnelParam.getId()==null){
            poresonnelParam.setDate(new Date());
            poersonnelMappper.addpoersonnel(poresonnelParam);
        }else {
//            poresonnelParam.setLogin(new Date());
//            poersonnelMappper.addpoersonnel(poersonnelVO);
        }
    }
}
